package gui;

import java.util.ArrayList;

import controller.ControllerManager;

public class GUIManager {
	//GUI Windows attributes
	private MainWindow mainwindow;
	public NewProject newproject;
	public OpenExistingProject openexist;
	public DiagramController diagram;
	public ControllerManager ctrl;

	private static GUIManager guimanager;
	// Note that the constructor is private
	private GUIManager() {
		mainwindow = new MainWindow();
		newproject = new NewProject();
		openexist = new OpenExistingProject();
		diagram = new DiagramController();
	}
	// get the singleton instance 
	public static GUIManager getDefault() {
		if (guimanager == null) {
			guimanager = new GUIManager();
		}
		return guimanager;
	}
	// To open the Main Window of the program 
	public void show(){
		mainwindow.open();		
	}

	// For Testing ONLY:
	public static void main(String args[]) {

		GUIManager gui = new GUIManager();
		gui.show();
	}
	// called by the ProgramManager main() when introducing GUI and CTRL to each other :)
	public void setControllerManager(ControllerManager ctrl)
	{
		this.ctrl=ctrl;
	}

	public void generatePackageDiagram(String string) {
		ctrl.generatePackageDiagram(string);
	}

	public void generateClassDiagram(String string) {
		ctrl.generateClassDiagram(string);
	}

	public void drawShapes(ArrayList<Shape> shapes) {
		diagram.drawShapes(shapes);
	}

}
